def initArr():
    return [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 63, 69, 73, 75, 75, 73, 69, 63, 55, 45, 36, 28, 21, 15, 10, 6, 3, 1]


'0, 360, 720, 0, 1800, 2520, 0, 4320, 5400, 0, 7560, 8280, 0, 9000, 9000, 0, 8280, 7560, 0, 5400, 4320, 0, 2520, 1800, 0, 720, 360, 0'


def initModel(name,remai = None):
    resultMap = {}
    arr = initArr()
    # 模式下注和
    modelSum = 0
    # 余数
    Remainder = 0
    # 除数
    Divisor = 0
    if name == "3N0":
        Divisor = 3
        Remainder = 0

    elif name == "3N1":
        Divisor = 3
        Remainder = 1
    elif name == "3N2":
        Divisor = 3
        Remainder = 2
    elif name == "4N0":
        Divisor = 4
        Remainder = 0
    elif name == "4N1":
        Divisor = 4
        Remainder = 1
    elif name == "4N2":
        Divisor = 4
        Remainder = 2
    elif name == "4N3":
        Divisor = 4
        Remainder = 3
    elif name == "5N0":
        Divisor = 5
        Remainder = 0
    elif name == "5N1":
        Divisor = 5
        Remainder = 1
    elif name == "5N2":
        Divisor = 5
        Remainder = 2
    elif name == "5N3":
        Divisor = 5
        Remainder = 3
    elif name == "5N4":
        Divisor = 5
        Remainder = 4
    elif name == "6N0":
        Divisor = 6
        Remainder = 0
    elif name == "6N1":
        Divisor = 6
        Remainder = 1
    elif name == "6N2":
        Divisor = 6
        Remainder = 2
    elif name == "6N3":
        Divisor = 6
        Remainder = 3
    elif name == "6N4":
        Divisor = 6
        Remainder = 4
    elif name == "6N5":
        Divisor = 6
        Remainder = 5
    elif name == "7N0":
        Divisor = 7
        Remainder = 0
    elif name == "7N1":
        Divisor = 7
        Remainder = 1
    elif name == "7N2":
        Divisor = 7
        Remainder = 2
    elif name == "7N3":
        Divisor = 7
        Remainder = 3
    elif name == "7N4":
        Divisor = 7
        Remainder = 4
    elif name == "7N5":
        Divisor = 7
        Remainder = 5
    elif name == "7N6":
        Divisor = 7
        Remainder = 6
    elif name == "8N0":
        Divisor = 8
        Remainder = 0
    elif name == "8N1":
        Divisor = 8
        Remainder = 1
    elif name == "8N2":
        Divisor = 8
        Remainder = 2
    elif name == "8N3":
        Divisor = 8
        Remainder = 3
    elif name == "8N4":
        Divisor = 8
        Remainder = 4
    elif name == "8N5":
        Divisor = 8
        Remainder = 5
    elif name == "8N6":
        Divisor = 8
        Remainder = 6
    elif name == "8N7":
        Divisor = 8
        Remainder = 7
    elif name == "9N0":
        Divisor = 9
        Remainder = 0
    elif name == "9N1":
        Divisor = 9
        Remainder = 1
    elif name == "9N2":
        Divisor = 9
        Remainder = 2
    elif name == "9N3":
        Divisor = 9
        Remainder = 3
    elif name == "9N4":
        Divisor = 9
        Remainder = 4
    elif name == "9N5":
        Divisor = 9
        Remainder = 5
    elif name == "9N6":
        Divisor = 9
        Remainder = 6
    elif name == "9N7":
        Divisor = 9
        Remainder = 7
    elif name == "9N8":
        Divisor = 9
        Remainder = 8
    elif name == "10N0":
        Divisor = 10
        Remainder = 0
    elif name == "10N1":
        Divisor = 10
        Remainder = 1
    elif name == "10N2":
        Divisor = 10
        Remainder = 2
    elif name == "10N3":
        Divisor = 10
        Remainder = 3
    elif name == "10N4":
        Divisor = 10
        Remainder = 4
    elif name == "10N5":
        Divisor = 10
        Remainder = 5
    elif name == "10N6":
        Divisor = 10
        Remainder = 6
    elif name == "10N7":
        Divisor = 10
        Remainder = 7
    elif name == "10N8":
        Divisor = 10
        Remainder = 8
    elif name == "10N9":
        Divisor = 10
        Remainder = 9
    # 计算模式当前基本模式下注和
    if  remai is None:
        for index, item in enumerate(arr):
            if index % Divisor == Remainder:
                arr[index] = 0
            modelSum += arr[index]
    if  remai is not None:
        groupFirstNum = int(name)
        # 大的组合
        if groupFirstNum == 13:
            for index, item in enumerate(arr):
                if index <= int(groupFirstNum) and index % 2 == int(remai):
                    arr[index] = 0
                modelSum += arr[index]
        # 小的组合
        if groupFirstNum == 14:
            for index, item in enumerate(arr):
                if index >= int(groupFirstNum) and index % 2 == int(remai):
                    arr[index] = 0
                modelSum += arr[index]
    # 结果返回
    resultMap["arr"] = arr
    resultMap["modelSum"] = modelSum
    return resultMap


"""
    初始化滚雪球模式数据 10w的目标的基数配置
"""


def initSnowballData():
    map = {}
    map["3N"] = [[80000, 120000],
                 [144000, 216000],
                 [259200, 388800],
                 [466560, 699840],
                 [839808, 1259712],
                 [1511654, 2267481],
                 [2720977, 4081465],
                 [4897759, 7346638],
                 [8815966, 13223949],
                 [15868739, 23803108],
                 [28563730, 42845595],
                 [51414714, 77122071],
                 [92546485, 138819727]]
    # map["4N"] = [[137037, 182716, 243621],
    #              [324828, 433104, 577472],
    #              [769963, 1026617, 1368823],
    #              [1825097, 2433462, 3244616],
    #              [4326156, 5768208, 7690944],
    #              [10254592, 13672789, 18230385],
    #              [24307181, 32409574, 43212766],
    #              [57617022, 76822696, 102430261],
    #              [136573681, 182098241, 242797655],
    #              [323730207, 431640276, 575520368],
    #              [767360491, 1023147321, 1364196428],
    #              [1818928571, 2425238094, 3233650792],
    #              [4311534391, 5748712521, 7664950028]]
    map["4N"] = [[137037, 182716],
                 [324828, 433104],
                 [769963, 1026617],
                 [1825097, 2433462],
                 [4326156, 5768208],
                 [10254592, 13672789],
                 [24307181, 32409574],
                 [57617022, 76822696],
                 [136573681, 182098241],
                 [323730207, 431640276],
                 [767360491, 1023147321],
                 [1818928571, 2425238094],
                 [4311534391, 5748712521]]

    map["5N"] = [[177777, 222221],
                 [493825, 617281],
                 [1371736, 1714670],
                 [3810378, 4762972],
                 [10584384, 13230480],
                 [29401066, 36751332],
                 [81669628, 102087035],
                 [226860078, 283575097],
                 [630166883, 787708603]]

    map["13N"] = [[137037, 182716],
                 [324828, 433104],
                 [769963, 1026617],
                 [1825097, 2433462],
                 [4326156, 5768208],
                 [10254592, 13672789],
                 [24307181, 32409574],
                 [57617022, 76822696],
                 [136573681, 182098241],
                 [323730207, 431640276],
                 [767360491, 1023147321],
                 [1818928571, 2425238094],
                 [4311534391, 5748712521]]

    map["14N"] = [[137037, 182716],
                  [324828, 433104],
                  [769963, 1026617],
                  [1825097, 2433462],
                  [4326156, 5768208],
                  [10254592, 13672789],
                  [24307181, 32409574],
                  [57617022, 76822696],
                  [136573681, 182098241],
                  [323730207, 431640276],
                  [767360491, 1023147321],
                  [1818928571, 2425238094],
                  [4311534391, 5748712521]]

    return map


def copy_Arr(arr):
    return arr.copy()


def getXZModelData(name, detailName, Multiplef_10w):
    SnowballData = initSnowballData()

    # N3 = SnowballData.get("3N")
    # resultMap = initModel("3N0")
    N3 = SnowballData.get(name)
    if detailName.find("N")!= -1 :
        resultMap = initModel(detailName)
    else:
        resultMap = initModel(detailName.split("-")[0],detailName.split("-")[1])
    arr = resultMap["arr"]
    modelSum = resultMap["modelSum"]
    MultipleMap = {}
    firstList = []
    index = 0
    for firstitem in N3:
        secondList = []
        firstList.append(secondList)
        for secondItem in firstitem:
            # 获取倍数
            Multiple = int(secondItem / modelSum)
            cpArr = copy_Arr(arr)
            for arrIndex in range(len(cpArr)):
                # 计算下注金额
                cpArr[arrIndex] = int(cpArr[arrIndex] * Multiple * Multiplef_10w)
            secondList.append(', '.join(map(str, cpArr)))
            index = index + 1
    return firstList


if __name__ == '__main__':
    # modelList = getXZModelData("3N", "3N0", 5)
    # print(modelList)
    # modelList = getXZModelData("3N", "3N0", 1)
    # print(modelList)
    # modelList = getXZModelData("3N", "3N0", 0.5)
    # print(modelList)
    # ls = 0
    # for i in modelList:
    #     ls = len(i)
    # print(f"滚雪球次数{len(modelList)}每轮{ls}次")
    # modelList = getXZModelData("3N", "3N1")
    # print(modelList)
    #
    # modelList = getXZModelData("3N", "3N2")
    # print(modelList)
    # modelList = getXZModelData("4N", "4N0")
    # print(modelList)
    # ls = 0
    # for i in modelList:
    #     ls = len(i)
    # print(f"滚雪球次数{len(modelList)}每轮{ls}次")
    # modelList = getXZModelData("4N", "4N1")
    # print(modelList)
    # modelList = getXZModelData("4N", "4N2")
    # print(modelList)
    # modelList = getXZModelData("4N", "4N3")
    # print(modelList)

    # print("13-0".split("-")[0]+",  "+"13-0".split("-")[1])
    # modelList = getXZModelData("13N","13-1",3)
    # for i in modelList:
    #     print(i)

    modelList = getXZModelData("13N","13-1",1)
    for i in modelList:
        print(i)
    print("13N-0============")
    modelList = getXZModelData("13N","13-0",1)
    for i in modelList:
        print(i)
    modelList = getXZModelData("14N","14-1",1)
    for i in modelList:
        print(i)
    print("14N-0============")
    modelList = getXZModelData("14N","14-0",1)
    for i in modelList:
        print(i)
    # print(modelList)
    # modelList = getXZModelData("5N","5N1")
    # print(modelList)
    # modelList = getXZModelData("5N","5N2")
    # print(modelList)
    # modelList = getXZModelData("5N","5N3")
    # print(modelList)
    # modelList = getXZModelData("5N","5N4")
    # print(modelList)
